<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <div>
            <my-cpn :title="msg" :letters="letters"></my-cpn>
        </div>
    </div>
    <template id="cpn1">
        <div>
            <h2>我是子组件</h2>
            <p>{{title}}</p>
            <ul>
                <li v-for="item in letters">{{item}}</li>
            </ul>
        </div>
    </template>

    <script>
        new Vue({
            el: '#app',
            data: {
                msg: '你好',
                letters: ['A', 'B', 'C']
            },
            components: {
                'my-cpn': {
                    template: '#cpn1',
                    // props: ['title', 'letters']
                    props: {
                        title: {
                            type: String,
                            default: '1111111111',
                            required: true
                        },
                        letters: {
                            type: Array,
                            default: []
                        }
                    }
                }
            }
        }) 
    </script>
</body>
</html>